const App = {
    data() {
        return {
            photo,
            formData:{},
            tableData:[],
            ACCESSTOKEN:'',
            total: 0,
            loading: false,
            tableData:[],
            tabs:{},
            action:'1',
        }
    },
    beforeCreate() {
        function setRem() {
            const designWidth = 750; // 设计稿宽度（rpx）
            const maxWidth = 540; // 可选：限制最大宽度（如手机端常见值）
            const screenWidth = Math.min(window.innerWidth, maxWidth);
            const scale = screenWidth / designWidth;
            document.documentElement.style.fontSize = scale + 'px';
        }
        setRem();//1rem = 0.5px 对标小程序在 375px 宽的屏幕上，1rpx = 0.5px（因为 750rpx / 375px = 2）
    },
    mounted() {
        let URL = window.location.href;
        this.ACCESSTOKEN = getQueryObject(URL, 'ACCESSTOKEN');
        let Scenic_Spot_Detail_SerialNumber = getQueryObject(URL, 'Scenic_Spot_Detail_SerialNumber');
        this.getList(Scenic_Spot_Detail_SerialNumber);
    },
    methods: {
        getList(nodeKey) {
            $.ajax({
                url: `../../api/tour_guide.json`,
                method: "GET",
                success: (data) => {
                    this.tabs = data;
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                method: "POST",
                data: {
                    Data: 'scenic_spot_detail',
                    Condition: `Scenic_Spot_Detail_SerialNumber='${nodeKey}'`,
                },
                success: (data) => {
                    if (data.length == 1) {
                        this.formData = data[0];
                    }
                },
                complete: (XMLHttpRequest) => {
                    
                },
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                method: "POST",
                data: {
                    Data: 'scenic_spot_attachment',
                    Condition: `Scenic_Spot_Detail_SerialNumber='${nodeKey}' AND Row_Status='0'`,
                },
                success: (data) => {
                    this.tableData = data;
                },
                complete: (XMLHttpRequest) => {
                    
                },
            });
        },
        handleClick(item) {//前往添加调查问卷
            window.location.href = h5 + item.Table_Name + '.html?ACCESSTOKEN=' + this.ACCESSTOKEN;
        }
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");